首页>代码>Spring Boot+vue项目通过docker-compose部署案例分享(前后端分离)>/【docker】- docker-compose实战之前后端分离项目部署/项目源码/bookManagerSys/src/main/java/com/cxs/config/SwaggerConfig.java
package com.cxs.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/*
 * @Author:cxs
 * @Version 1.0
 * @Motto:放下杂念,只为迎接明天更好的自己
 * */
@EnableSwagger2
@ComponentScan(basePackages = {"com.cxs.controller","com.cxs.model"})
public class SwaggerConfig extends WebMvcConfigurationSupport {
    //配置Swagger的Docket的bean
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cxs.controller"))
                .build();
    }
    //配置Swagger信息=apiinfo
    public ApiInfo apiInfo(){
        //作者信息 springfox.documentation.service.C
        Contact contact = new Contact("cxs","http://www.baidu.com","1174586985@qq.com");
        return new ApiInfo(
                "图书管理系统接口文档",
                "即使再小的帆也能远航...",
                "v1.1",
                "http://www.baidu.com",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");

        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");

    }
}
最近下载更多
taoyi123  LV17 2023年5月5日
最代码官方  LV167 2023年5月3日
最近浏览更多
kenhomeliu  LV29 4月30日
strongning  LV3 4月5日
WBelong  LV7 3月27日
Gin19960217  LV4 3月18日
dapeng0011  LV13 2月26日
limin123  LV6 2月9日
哪里的完整版  LV7 2月1日
暂无贡献等级
kinggode  LV14 2023年12月13日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友